package product;

import javax.imageio.ImageIO;
import javax.swing.JInternalFrame;
import javax.swing.JLabel;

import java.awt.Font;
import java.awt.Image;
import java.awt.Toolkit;

import javax.swing.ImageIcon;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
import javax.swing.JButton;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.SwingConstants;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.DefaultTableModel;

import product.CompanyData;
import product.DeliveryData;
import product.ProductMain4;

import java.awt.Color;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.text.DecimalFormat;
import java.util.Vector;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.image.BufferedImage;
import java.io.File;

import javax.swing.JLayeredPane;
import javax.swing.border.LineBorder;

import java.awt.SystemColor;
import java.awt.Dimension;

import javax.swing.JPanel;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;

public class CompanyUpdate extends JInternalFrame {

CompanyData cd;
DeliveryData dd;
Vector<String> tableName = new Vector<String>();           //  테이블에 저장하는 도구
DefaultTableModel model;                                           //  테이블에 값을 저장하기 위한 격납고
String fileName = "noname";                                        //  사진 저장을 위한 경로를 만들어주기 위해서
String folder = "img\\logo\\";                                   //  이미지를 저장할 경로 폴더 설정을 위해서

boolean flag = true;

ProductMain4 main;
JTextField txtNum;    // 사업자번호
JTextField txtCom;    // 회사이름
JTextField txtCeo;    // 회사대표
JTextField txtFax;    // 팩스번호
JTextField txtPhone;  // 전화번호
JTextField txtAddr;   // 주    소
JLabel txtLogo;
private JButton btnNewButton;
private JButton btnNewButton_1;
private JScrollPane scrollPane;
private JTable table;
private JLabel lblNewLabel_1;
private JLabel status;
private JButton btnNewButton_2;
private JButton btnNewButton_3;
private JButton btnNewButton_4;
private JLabel logoStatus;
private JLabel lblLicenseNumber;
private JLabel lblCEO;
private JLabel lblCompanyName;
private JLabel lblOperating;
private JLabel lblPhoneNo;
private JLabel lblFaxNo;
private JPanel panel;
private JLabel label;
private JButton button;
private JLabel label_1;
private JLayeredPane layeredPane;

//------------------------------------ 생성자 Start ------------//	
public CompanyUpdate(ProductMain4 main) {
	super("Company Update",false,true,false,true);
	addComponentListener(new ComponentAdapter() {
		@Override
		public void componentHidden(ComponentEvent e) {
			clear();  // CompanyUpdate 가 실행 될때마다, 모든 창을 초기화 시켜주는 메서드
		}
	});
	getContentPane().setBackground(Color.WHITE);
	setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
	setTitle("Customer Update");
	setBounds(100, 100, 574, 568);
	
	this.main = main;

	getContentPane().setLayout(null);
	getContentPane().add(getStatus());
	getContentPane().add(getScrollPane());
	getContentPane().add(getLblNewLabel_1());
	getContentPane().add(getBtnNewButton_4());
	getContentPane().add(getBtnNewButton_3());
	getContentPane().add(getPanel());
	getContentPane().add(getLabel_1());
	
}
//------------------------------------ 생성자 End ------------//	

//------------------------------------------------------ 필요 메서드 Start ------------//	
public void search(){
// **************************** Customer DB 출력*******************************************
	
	String sql = "select * from customer where num=?";
	try{

		PreparedStatement pstmt = main.conn.prepareStatement(sql);
		pstmt.setString(1, txtNum.getText());
		
		ResultSet rs = pstmt.executeQuery();
		
		if(rs.next()){					
			txtNum.setText(rs.getString(1));
			txtCom.setText(rs.getString(2));
			txtCeo.setText(rs.getString(3));
			txtAddr.setText(rs.getString(4));
			txtPhone.setText(rs.getString(5));
			txtFax.setText(rs.getString(6));
		}
		rs.close();
		pstmt.close();
	}catch(Exception ex){
		ex.printStackTrace();
	}
	
// **************************** 회사 이미지 출력 *******************************************
		
	Image imagetemp = Toolkit.getDefaultToolkit().getImage(folder + txtNum.getText() + ".png");           // 해당 경로의 아이템을 Image 타입의 변수에 담는다.
    
	/*
	 * 회사 이미지를 출력하기 위해서는 해당 폴더에 이미지가 있는지 없는지를 체크해주어야 한다.
	 * 그래서 이미지의 존재 여부를 파악하기 위해서 f.isFile()로 확인을 한다. 그리고 파일의 유무에 따라서
	 * 파일을 출력 유무를 Boolean ImgOk 를 통해서 구분해준다.
	 */
			
	File f = new File(folder + txtNum.getText() + ".png");                  // File 타입으로 경로에 해당하는 파일을 담는다.
	boolean ImgOk;
    
    if (f.isFile()) {              // 파일 존재 여부를 판단하는 역할을 한다.
    	ImgOk = true;
    	logoStatus.setText("");
    }
    else { 
    	ImgOk = false; 
    	txtLogo.setText("");
    	txtLogo.setIcon(new ImageIcon(""));
    	logoStatus.setText("Not Regist");
    }
    
	if(ImgOk){    //  해당 경로에 파일이 존재했을 경우에 실행한다.
		Image image = imagetemp.getScaledInstance(100, 100, Image.SCALE_SMOOTH);   // 이미지를 리사이즈 시켜준다.
	    ImageIcon icontemp = new ImageIcon(image);                                             // resize 이미지를 ImageIcon 타입으로 저장을 한다.
	    txtLogo.setText("");
	    logoStatus.setText("");
		txtLogo.setIcon(icontemp);
    }
	    
// **************************** Delivery DB 출력*******************************************
	String sql2 = "select num as \"번호\", ea as \"수량\", to_char(nal,'yyyy-mm-dd') as \"날짜\",customer_num as \"사업자번호\", code as \"코드\", member_id as \"사원번호\" from delivery where customer_num = ? order by nal desc";
	try {
		
		PreparedStatement pstmt2 = main.conn.prepareStatement(sql2);
		pstmt2.setString(1, txtNum.getText());
				
		ResultSet rs2 = pstmt2.executeQuery();      // 실핼된 반환 순수데이터를 담는다
		ResultSetMetaData rsm = rs2.getMetaData();  // 순수 데이터의 컬럼 값을 뽑기 위해서 다시 정제한다.
		
		DefaultTableCellRenderer center = new DefaultTableCellRenderer();  // 테이블을 중앙정렬하는 렌더러
		center.setHorizontalAlignment(SwingConstants.CENTER);
		DefaultTableCellRenderer right = new DefaultTableCellRenderer();   // 테이블을 우측정렬하는 렌더러
		right.setHorizontalAlignment(SwingConstants.RIGHT);
		
		DefaultTableCellRenderer renderer = (DefaultTableCellRenderer) table.getTableHeader().getDefaultRenderer();  // 테이블의 헤더(컬럼)를 중앙 정렬하는 방법
		renderer.setHorizontalAlignment(0);
		
		if(rs2.next()){     // 테이블의 컬럼
			Vector col = new Vector<>();
			for(int i=1; i <=rsm.getColumnCount(); i++){
				col.add(rsm.getColumnName(i));
			}
			model = new DefaultTableModel(col, 0);                        // tableModel 에 Vector col 을 넣는다.
			
			table.setModel(model);                                        // model 값을 table에 넣는다.
			
			table.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);      // 테이블을 각각 사이즈를 맞춘다.
			
			table.getColumnModel().getColumn(0).setPreferredWidth(50);
			table.getColumnModel().getColumn(0).setCellRenderer(right);   // 첫 번째 컬럼을 오른쪽 정렬
			table.getColumnModel().getColumn(1).setPreferredWidth(50);
			table.getColumnModel().getColumn(1).setCellRenderer(right);   // 두 번째 컬럼을 오른쪽 정렬
			table.getColumnModel().getColumn(2).setPreferredWidth(140);
			table.getColumnModel().getColumn(2).setCellRenderer(center);  // 세 번째 컬럼을 중앙 정렬
			table.getColumnModel().getColumn(3).setPreferredWidth(140);
			table.getColumnModel().getColumn(3).setCellRenderer(center);  // 네 번째 컬럼을 중앙 정렬
			table.getColumnModel().getColumn(4).setPreferredWidth(60);
			table.getColumnModel().getColumn(4).setCellRenderer(center);  // 다섯 번째 컬럼을 중앙 정렬
			table.getColumnModel().getColumn(5).setPreferredWidth(60);
			table.getColumnModel().getColumn(5).setCellRenderer(right);   // 여섯 번째 컬럼을 오른쪽 정렬
			
			while(rs2.next()){       // 테이블의 순수 데이터 
				DecimalFormat ff=new DecimalFormat("#,###");
				Vector d = new Vector<>();
				
				// ResultSet 의 rs 의 컬럼은 '1'부터이다. 맨 처음에 '0' 을 넣었을 때 에러를 발생시켰다.
				d.add(rs2.getString(1));
				d.add(ff.format(rs2.getInt(2)));
				d.add(rs2.getString(3));
				d.add(rs2.getString(4));
				d.add(rs2.getString(5));
				d.add(rs2.getString(6));
									
				status.setText("");
				model.addRow(d);
			}
	   }
		else{
		   status.setText("This company does not have the details of the delivery");
		   model = new DefaultTableModel();
		   table.setModel(model);
		   model.setNumRows(0);
	   }
		rs2.close();
		pstmt2.close();
	} catch (Exception ex) {
		ex.printStackTrace();
	}
}

public void openUpdate(){  // 업데이트 실행
	//txtNum-사업자번호  txtCom-회사이름  txtCeo-대표이사  txtAddr-주소  txtPhone-전화번호  txtFax-팩스번호
	String num = txtNum.getText();
	String com = txtCom.getText();
	String ceo = txtCeo.getText();
	String addr = txtAddr.getText();
	String phone = txtPhone.getText();
	String fax = txtFax.getText();
	String img = txtLogo.getText();
	
	String sql = "update customer set num = ?, name = ?,  ceo = ?, address = ?, phone = ?, fax = ? where num = ?";
	
	try {
		PreparedStatement pstmt = main.conn.prepareStatement(sql);
		
		pstmt.setString(1, num);  pstmt.setString(2, com);
		pstmt.setString(3, ceo);  pstmt.setString(4, addr);
		pstmt.setString(5, phone);
		pstmt.setString(6, fax);  pstmt.setString(7, num);
		
		pstmt.executeQuery();
		
		main.tList.searchData();   // Customer의 DB가 수정이 되고 나서 List에 바로 반영시키기.
		
		pstmt.close();
	}
	catch (Exception ex) {
		ex.printStackTrace();
	}
}

public void openDelete(){
	String num = txtNum.getText();
	String sql = "delete from customer where num = ?";
	
	try {
		PreparedStatement pstmt = main.conn.prepareStatement(sql);
		pstmt.setString(1, num);
		pstmt.executeQuery();
		main.tList.searchData();
		
		pstmt.close();
		
		this.flag = true;
	}
	 catch (Exception ex) {
		ex.printStackTrace();
		this.flag = false;
	}
}
//로고 이미지 수정
public void logo() {                                                                    
	try {
		JFileChooser fc = new JFileChooser();
		int yn = fc.showOpenDialog(this);
		if (yn == JFileChooser.APPROVE_OPTION) {
			File f = fc.getSelectedFile();
			fileName = f.getPath();
			
			// 이미지를 가져온 후 그 이미지의 사이즈를 조정해서 셋팅 
			Image imagetemp =new ImageIcon(fileName).getImage();                         //이미지생성
		    Image image= imagetemp.getScaledInstance(100, 100, Image.SCALE_SMOOTH);      //이미지리사이즈
		    ImageIcon icontemp =new ImageIcon(image);                                    //리사이즈된 이미지아이콘생성
		    txtLogo.setText("");
		    logoStatus.setText("");
			txtLogo.setIcon(icontemp);
		}
	} catch (Exception ex) {
		ex.printStackTrace();
	}
} 
// 로고 이미지 삭제
public void removeLogo(){                                                             
	File file = new File(folder + txtNum.getText() + ".png");                          // 해당 경로의 파일을 선택
	if(file.exists() == true){  
		file.delete();                                                                 //  해당 파일이 있다면 지워준다.
	}
	txtLogo.setText("");
	txtLogo.setIcon(new ImageIcon(""));
	logoStatus.setText("Delete Logo");
}
public void clear(){
	txtCom.setText("");	   txtCeo.setText("");
	txtNum.setText("");	   txtAddr.setText("");
	txtPhone.setText("");  txtFax.setText("");
	txtLogo.setIcon(new ImageIcon(""));                                     // 이미지 공백처리
	
	model = (DefaultTableModel)table.getModel();                            // 테이블 생성 하고
	model.setNumRows(0);                   
}

//------------------------------------------------------ 필요 메서드 End ------------//	

//------------------------------------------ 버튼 Start ------------------------------------------//
private JButton getBtnNewButton() {
	if (btnNewButton == null) {
		btnNewButton = new JButton("Save");
		btnNewButton.setBorder(new LineBorder(Color.GRAY));
		btnNewButton.setBounds(385, 179, 109, 30);
		btnNewButton.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				// 텍스트창이 모두 채워지지 않을 경우
				if(txtNum.getText().equals("") ||txtCom.getText().equals("") || txtCeo.getText().equals("") 
						|| txtAddr.getText().equals("") || txtPhone.getText().equals("") || txtFax.getText().equals("") ){
					JOptionPane.showMessageDialog(null, "Please fill in all the blanks.");
				}
				// 텍스트 창에 값이 모두 채워진 경우
				else{
					openUpdate();
					try{
						BufferedImage img = ImageIO.read(new File(fileName));
						ImageIO.write(img, "png", new File(folder + txtNum.getText()+".png"));
					}catch(Exception ex){
						ex.printStackTrace();
					}
					JOptionPane.showMessageDialog(null, "Modified.");
				}
			}
		});
		btnNewButton.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 15));
	}
	return btnNewButton;
}
private JButton getBtnNewButton_1() {
	if (btnNewButton_1 == null) {
		btnNewButton_1 = new JButton("Delete");
		btnNewButton_1.setBorder(new LineBorder(Color.GRAY));
		btnNewButton_1.setBounds(385, 218, 109, 30);
		btnNewButton_1.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				String num = txtNum.getText();	String com = txtCom.getText();
				String ceo = txtCeo.getText();  String addr = txtAddr.getText();
				String phone = txtPhone.getText();
				String fax = txtFax.getText();  String img = txtLogo.getText();
							
				if(num.equals("")){
					JOptionPane.showMessageDialog(null, "Not Regist License Number");
				}
				else{
					int b = JOptionPane.showConfirmDialog(null, "Do you want to delete?");
					if(b == JOptionPane.YES_OPTION){
						openDelete();
																								// OpenDelete 에 에러 판별에 대해서 flag 값의 true, false 값을 설정
						if(flag){ JOptionPane.showMessageDialog(null, "Remove complete"); }     //  DB에서 에러가 없을 경우 지워준다.
						else{ JOptionPane.showMessageDialog(null, "You can't remove!!"); }      //  DB에서 에러가 발생하면 경고창을 띄운다.
						
						clear() ;                                // 테이블 초기화 한다.
						
					}else if(b == JOptionPane.NO_OPTION){
						JOptionPane.showMessageDialog(null, "Cancled");
					}
				}
			}
		});
		btnNewButton_1.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 15));
	}
	return btnNewButton_1;
}

private JButton getBtnNewButton_3() {
	if (btnNewButton_3 == null) {
		btnNewButton_3 = new JButton("Help");
		btnNewButton_3.setBorder(new LineBorder(Color.GRAY));
		btnNewButton_3.setToolTipText("도움말");
		btnNewButton_3.setBounds(457, 11, 77, 30);
		btnNewButton_3.setFont(new Font("Microsoft JhengHei UI", Font.PLAIN, 15));
		btnNewButton_3.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				String message = "<html><body><div width='300px' align='center'>** Help Desk **</div>"
						+ "<div width='300px'><br/>"
						+ "- First, License Number is must be Registered in our Database.<br/>"
						+ "- Twice, IF you want to delete or modify, select the 'Search' Button.<br/>"
						+ "- If you have any questions, Please Contact us by Email<br/>"
						+ "&nbsp&nbsp Our Email : admin@companyupdate.com <br/> "
						+ "</body></html>";
				JLabel messageLabel = new JLabel(message);
				JOptionPane.showMessageDialog(null, messageLabel, "도움말", JOptionPane.QUESTION_MESSAGE);
			}
		});
	}
	return btnNewButton_3;
}
private JButton getBtnNewButton_4() {
	if (btnNewButton_4 == null) {
		btnNewButton_4 = new JButton("Search");
		btnNewButton_4.setBorder(new LineBorder(Color.GRAY));
		btnNewButton_4.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 15));
		btnNewButton_4.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				main.openList();                                                 // Main에 있는 리스트를 열 수 있는 함수, openList()를 실행한다.
				main.tList.getComboBox_1().setSelectedItem("거래처");            // Main을 통해서 tList를 들어가서 콤보박스에 거래처를 선택한다.
				main.tList.searchData();                                         // tList 에서 자료를 찾는 searchData를 실행한다.
			}
		});
		btnNewButton_4.setBounds(371, 11, 77, 30);
	}
	return btnNewButton_4;
}

private JButton getBtnNewButton_2() {
	if (btnNewButton_2 == null) {
		btnNewButton_2 = new JButton("");
		btnNewButton_2.setToolTipText("Image Add");
		btnNewButton_2.setFont(new Font("굴림", Font.BOLD, 15));
		btnNewButton_2.setIcon(new ImageIcon("img\\jpeg_plus.jpg"));
		btnNewButton_2.setBounds(389, 130, 45, 30);
		btnNewButton_2.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				logo();
			}
		});
	}
	return btnNewButton_2;
}
//------------------------------------------ 버튼 End ------------------------------------------//

//---------------- 테이블 Start --------------------------------------------------------------------//
private JTable getTable() {
	if (table == null) {
		table = new JTable();
	}
	return table;
}
public JTextField getTxtNum() {
	if (txtNum == null) {
		txtNum = new JTextField();
		txtNum.setBorder(new LineBorder(Color.GRAY));
		txtNum.setBounds(189, 10, 170, 30);
		txtNum.setEditable(false);
		txtNum.setColumns(10);
	}
	return txtNum;
}
private JTextField getTxtCom() {
	if (txtCom == null) {
		txtCom = new JTextField();
		txtCom.setBorder(new LineBorder(Color.GRAY));
		txtCom.setBounds(189, 52, 170, 30);
		txtCom.setColumns(10);
	}
	return txtCom;
}
private JTextField getTxtCeo() {
	if (txtCeo == null) {
		txtCeo = new JTextField();
		txtCeo.setBorder(new LineBorder(Color.GRAY));
		txtCeo.setBounds(189, 94, 170, 30);
		txtCeo.setColumns(10);
	}
	return txtCeo;
}
private JTextField getTxtFax() {
	if (txtFax == null) {
		txtFax = new JTextField();
		txtFax.setBorder(new LineBorder(Color.GRAY));
		txtFax.setBounds(189, 220, 170, 30);
		txtFax.setColumns(10);
	}
	return txtFax;
}
private JTextField getTxtPhone() {
	if (txtPhone == null) {
		txtPhone = new JTextField();
		txtPhone.setBorder(new LineBorder(Color.GRAY));
		txtPhone.setBounds(189, 178, 170, 30);
		txtPhone.setColumns(10);
	}
	return txtPhone;
}
private JTextField getTxtAddr() {
	if (txtAddr == null) {
		txtAddr = new JTextField();
		txtAddr.setBorder(new LineBorder(Color.GRAY));
		txtAddr.setBounds(189, 136, 170, 30);
		txtAddr.setColumns(10);
	}
	return txtAddr;
}
private JScrollPane getScrollPane() {
	if (scrollPane == null) {
		scrollPane = new JScrollPane();
		scrollPane.setBackground(SystemColor.inactiveCaptionBorder);
		scrollPane.setBorder(new LineBorder(new Color(128, 128, 128), 2));
		scrollPane.setBounds(20, 354, 513, 178);
		scrollPane.setViewportView(getTable());
	}
	return scrollPane;
}	
private JLabel getLblNewLabel_1() {
	if (lblNewLabel_1 == null) {
		lblNewLabel_1 = new JLabel("Merchandise Transaction Statement");
		lblNewLabel_1.setForeground(SystemColor.text);
		lblNewLabel_1.setBorder(new LineBorder(Color.GRAY, 2));
		lblNewLabel_1.setOpaque(true);
		lblNewLabel_1.setBackground(SystemColor.textHighlight);
		lblNewLabel_1.setHorizontalAlignment(SwingConstants.CENTER);
		lblNewLabel_1.setFont(new Font("Microsoft JhengHei UI", Font.BOLD, 15));
		lblNewLabel_1.setBounds(20, 330, 513, 25);
	}
	return lblNewLabel_1;
}
private JLabel getTxtLogo() {
	if (txtLogo == null) {
		txtLogo = new JLabel("Logo");
		txtLogo.setBounds(5, 9, 100, 100);
		txtLogo.setFont(new Font("Microsoft YaHei UI", Font.BOLD, 13));
		txtLogo.setForeground(Color.RED);
		txtLogo.setBorder(new LineBorder(Color.GRAY, 2));
		txtLogo.setHorizontalAlignment(SwingConstants.CENTER);
	}
	return txtLogo;
}
	private JLabel getStatus() {
		if (status == null) {
			status = new JLabel("");
			status.setBounds(20, 411, 513, 30);
			status.setBorder(null);
			status.setBackground(SystemColor.info);
			status.setFont(new Font("Microsoft YaHei UI", Font.BOLD, 15));
			status.setForeground(Color.RED);
			status.setHorizontalAlignment(SwingConstants.CENTER);
		}
		return status;
	}
	private JLabel getLogoStatus() {
		if (logoStatus == null) {
			logoStatus = new JLabel("");
			logoStatus.setBounds(389, 62, 102, 15);
			logoStatus.setForeground(Color.RED);
			logoStatus.setFont(new Font("Microsoft YaHei UI", Font.BOLD, 13));
			logoStatus.setHorizontalAlignment(SwingConstants.CENTER);
		}
		return logoStatus;
	}
	private JLabel getLblLicenseNumber() {
		if (lblLicenseNumber == null) {
			lblLicenseNumber = new JLabel("License Number ");
			lblLicenseNumber.setBounds(26, 10, 170, 30);
			lblLicenseNumber.setPreferredSize(new Dimension(70, 20));
			lblLicenseNumber.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 15));
		}
		return lblLicenseNumber;
	}
	private JLabel getLblCEO() {
		if (lblCEO == null) {
			lblCEO = new JLabel("C. E. O");
			lblCEO.setBounds(26, 94, 170, 30);
			lblCEO.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 15));
		}
		return lblCEO;
	}
	private JLabel getLblCompanyName() {
		if (lblCompanyName == null) {
			lblCompanyName = new JLabel("Company Name");
			lblCompanyName.setBounds(26, 52, 170, 30);
			lblCompanyName.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 15));
		}
		return lblCompanyName;
	}
	private JLabel getLblOperating() {
		if (lblOperating == null) {
			lblOperating = new JLabel("Operating Address");
			lblOperating.setBounds(26, 136, 170, 30);
			lblOperating.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 15));
		}
		return lblOperating;
	}
	private JLabel getLblPhoneNo() {
		if (lblPhoneNo == null) {
			lblPhoneNo = new JLabel("Phone Number");
			lblPhoneNo.setBounds(26, 178, 170, 30);
			lblPhoneNo.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 15));
		}
		return lblPhoneNo;
	}
	private JLabel getLblFaxNo() {
		if (lblFaxNo == null) {
			lblFaxNo = new JLabel("Fax Number");
			lblFaxNo.setBounds(26, 220, 170, 30);
			lblFaxNo.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 15));
		}
		return lblFaxNo;
	}
	private JPanel getPanel() {
		if (panel == null) {
			panel = new JPanel();
			panel.setBackground(SystemColor.inactiveCaptionBorder);
			panel.setBorder(new LineBorder(Color.GRAY, 2));
			panel.setBounds(21, 49, 512, 259);
			panel.setLayout(null);
			panel.add(getLblFaxNo());
			panel.add(getLblPhoneNo());
			panel.add(getLblOperating());
			panel.add(getLblCEO());
			panel.add(getLblCompanyName());
			panel.add(getLblLicenseNumber());
			panel.add(getTxtNum());
			panel.add(getTxtCom());
			panel.add(getTxtCeo());
			panel.add(getTxtAddr());
			panel.add(getTxtPhone());
			panel.add(getTxtFax());
			panel.add(getLogoStatus());
			panel.add(getLabel());
			panel.add(getBtnNewButton_2());
			panel.add(getButton());
			panel.add(getBtnNewButton_1());
			panel.add(getBtnNewButton());
			panel.add(getLayeredPane_1());
		}
		return panel;
	}
	private JLabel getLabel() {
		if (label == null) {
			label = new JLabel("New label");
			label.setBounds(371, 10, 3, 240);
			label.setBorder(new LineBorder(Color.GRAY, 2));
			label.setBackground(Color.GRAY);
		}
		return label;
	}
	private JButton getButton() {
		if (button == null) {
			button = new JButton("");
			button.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent e) {
					removeLogo();
				}
			});
			button.setToolTipText("Image Delete");
			button.setFont(new Font("굴림", Font.BOLD, 7));
			button.setIcon(new ImageIcon("img\\jpeg_minus.jpg"));
			button.setBounds(445, 130, 45, 30);
		}
		return button;
	}

	private JLabel getLabel_1() {
		if (label_1 == null) {
			label_1 = new JLabel("Customer Information");
			label_1.setForeground(Color.DARK_GRAY);
			label_1.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 15));
			label_1.setBounds(24, 14, 224, 30);
		}
		return label_1;
	}
	private JLayeredPane getLayeredPane_1() {
		if (layeredPane == null) {
			layeredPane = new JLayeredPane();
			layeredPane.setBorder(new LineBorder(Color.ORANGE, 2));
			layeredPane.setBounds(385, 10, 109, 156);
			layeredPane.add(getTxtLogo());
		}
		return layeredPane;
	}
}
